package o2o.task.order;

import o2o.system.data.SYS_SETTINGS;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

// 订单自动备份
@Component
public class OrderBakTask {


    // 备份订单（定时执行一次，为了后台统计）
    @Scheduled(cron = "0 0/10 * * * ?")
    public void auto_bak_old_order() {
        if (null != SYS_SETTINGS.USE_BAK_ORDER && 0 == 1 - SYS_SETTINGS.USE_BAK_ORDER) {
            OrderBakTaskUtils.backOrder();
        }

    }

    // 自动备份订单（每天1,10 15点）
    @Scheduled(cron = "0 0 1,10,15 * * ?")
//    @Scheduled(cron = "0 */1 * * * ?")
    public void auto_old_order() {
        if (null != SYS_SETTINGS.USE_BAK_ORDER && 0 == 1 - SYS_SETTINGS.USE_BAK_ORDER) {
            OrderBakTaskUtils.autoBackOrder(null);
        }
    }


}
